package com.geotmt.billingcenter.modules.consume.service.impl;

import com.geotmt.billingcenter.common.entry.ConsumeRuleEntry;
import com.geotmt.billingcenter.modules.consume.mapper.ConsumeRuleMapper;
import com.geotmt.billingcenter.modules.consume.service.ConsumeRuleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @Description 消耗 Rule
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/3/13 11:16
 * @Version     v1
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class ConsumeRuleServiceImpl implements ConsumeRuleService {

    private static final Logger logger = LoggerFactory.getLogger(ConsumeRuleServiceImpl.class);

    @Resource
    private ConsumeRuleMapper consumeRuleMapper;

    @Override
    public Integer addRule(ConsumeRuleEntry consumeRule) {
        logger.info("消耗 subRule add Service");
        consumeRuleMapper.addRule(consumeRule);
        return consumeRule.getId();
    }
}
